import request from '@/utils/request'

// 查询VIP自动续费列表
export function listVipAutoRenew(query) {
  return request({
    url: '/app/vip/autoRenew/list',
    method: 'get',
    params: query
  })
}

// 新增VIP自动续费
export function addVipAutoRenew(data) {
  return request({
    url: '/app/vip/autoRenew',
    method: 'post',
    data: data
  })
}

// 修改VIP自动续费
export function updateVipAutoRenew(data) {
  return request({
    url: '/app/vip/autoRenew',
    method: 'put',
    data: data
  })
}

// 删除VIP自动续费
export function delVipAutoRenew(ids) {
  return request({
    url: '/app/vip/autoRenew/' + ids,
    method: 'delete'
  })
}

// 取消用户的自动续费
export function cancelAutoRenew(userId) {
  return request({
    url: '/app/vip/autoRenew/cancel/' + userId,
    method: 'post'
  })
}

// 微信委托代扣签约
export function signWechatContract(userId) {
  return request({
    url: '/app/vip/autoRenew/wechat/contract/sign/' + userId,
    method: 'post'
  })
}

// 查询用户的微信委托代扣签约状态
export function getWechatContractStatus(userId) {
  return request({
    url: '/app/vip/autoRenew/wechat/contract/status/' + userId,
    method: 'get'
  })
}

// 手动触发自动续费任务（仅用于测试）
export function triggerAutoRenewTask() {
  return request({
    url: '/app/vip/autoRenew/trigger',
    method: 'post'
  })
}